package com.fucking.great.context.plun;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.fucking.great.context.TxnContext;
import com.fucking.great.context.exception.TxnRuntimeException;

import java.util.Locale;
import java.util.Map;

/**
 * 用于调用方法.
 */
public class ContextPlug  extends BasePlug{
    public static final String PLUN_NAME = "context";

    public ContextPlug( Map<String, String> config) {
        super( config,new String[]{
                Locale.class.getName(),
                TxnContext.class.getName(),
                JSONArray.class.getName(),
                JSONObject.class.getName(),
                TxnRuntimeException.class.getName()
        });
    }

    @Override
    protected void initUserPlunMap(Map<String, Object> userPlun) {
        TxnContext context = TxnContext.getContext();
        userPlun.put(PLUN_NAME,context);
    }



}
